﻿///******************************************************    
///	FileName: PurchaseAdd.js
///	Action: 会员中心证书页面JS处理文件
///	Copyright(c)  2004-2008 网胜科技公司技术开发部
///	Writer: XFY
///	Create Date: 2008-12-17
///	Rewriter:
///	Rewrite Date:
///******************************************************  
var rightIcon="../images/websen.gif"
var rightIcons="../../../images/icon_nothing.gif";
var txtjbo=new  Array("ctl00_ContInfo_txtName","ctl00_ContInfo_txtOrganization")
function getobj(objName)
{
	if ($) {return eval('$("'+ objName +'")');}
	else {return eval('document.all["'+ objName +'"]');}
}
//得到焦点
for(var i=0;i<txtjbo.length;i++){ $(txtjbo[i]).onfocus =function ()
{for (var j=0;j<txtjbo.length;j++)
{if (txtjbo[j]==event.srcElement.id){postobj(j);}}}}
function postobj(num)
{
obj = "txt"+num;
document.getElementById(obj).innerHTML =Certificate[num];
}
function oo(){$("yc").style.display="none"}
//失去焦点
for(var i=0;i<txtjbo.length;i++){ $(txtjbo[i]).onblur =function ()
{for (var j=0;j<txtjbo.length;j++)
{if (txtjbo[j]==event.srcElement.id){postobjs(j);}}}}
function postobjs(num)
{
  var obj="txt"+num;
if ($(obj).innerHTML!="")
  {$(obj).innerHTML=""}
else 
  {$(obj).innerHTML=ok;}
}
//处理函数
$("ctl00_ContInfo_txtLicenceDate").onclick=function()
{
  if (WillAgent("ctl00_ContInfo_txtLicenceDate",2)==false)
  {
    $("txt2").innerHTML=""
  }
}
$("ctl00_ContInfo_txtExpiryDate").onclick=function()
{
  if (WillAgent("ctl00_ContInfo_txtExpiryDate",3)==false)
  {
    $("txt3").innerHTML=""
  }
}
//提交函数
$("ctl00_ContInfo_btnServer").onclick=function Server(){
var Will=new Array()
Will[0]=WillAgent(txtjbo[0],0)
Will[1]=WillAgent(txtjbo[1],1)
Will[2]=WillAgent("ctl00_ContInfo_txtLicenceDate",2)
Will[3]=WillAgent("ctl00_ContInfo_txtExpiryDate",3)
var flag=1;
for (i=0;i<4;i++)
{
   if (Will[i]==false)
   {
      flag=0;
      break;
   }
} 
if(flag==0)
  return false;
else
  if(FileUPload(2)!=0)
    { alert("上传图片不能为空!")
      return false
    }
 return true
 }
function WillAgent(name,num)
{
 var obj="txt"+num
 if($(name).value.replace(/\s/g,'')=="")
  {
   $(obj).innerHTML=TjZs[num]
   return false
  }
  else 
  {
    $(obj).innerHTML=ok;
    return true
  }
}

var ok="<font color=#999999>输入符合规范</font>";
var title="<p>";
var titles="</p>"
var Certificate=new Array()
Certificate[0]=title+"请输入证书名称"+titles
Certificate[1]=title+"请输入证书地址"+titles
Certificate[2]=title+"请输入发证机构"+titles
Certificate[3]=title+"请输入发证时间"+titles
Certificate[4]=title+"请输入证书有效期"+titles
//添加证书
var TjZs=new Array()
TjZs[0]="<img src="+rightIcon+" align=\"absmiddle\"> <font color=#FF0000>证书名称不能为空</font>";
TjZs[1]="<img src="+rightIcon+" align=\"absmiddle\"> <font color=#FF0000>证书地址不能为空</font>";
TjZs[2]="<img src="+rightIcon+" align=\"absmiddle\"> <font color=#FF0000>发证机构不能为空</font>";
TjZs[3]="<img src="+rightIcon+" align=\"absmiddle\"> <font color=#FF0000>发证日期不能为空</font>";
TjZs[4]="<img src="+rightIcon+" align=\"absmiddle\"> <font color=#FF0000>证书有效期不能为空</font>";
